(self.AMP=self.AMP||[]).push({n:"amp-iframe",v:"2102130314001",m:0,f:(function(AMP,_){ 'use strict';var l,aa="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b};function ba(a){for(var b=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global],c=0;ca.indexOf(b)?(a.push(b),!0):!1};var I,xa="Webkit webkit Moz moz ms O o".split(" ");function ya(a,b){var c=a.style;if("zIndex".startsWith("--"))c="zIndex";else{I||(I=Object.create(null));var d=I.zIndex;if(!d){d="zIndex";if(void 0===c.zIndex){var e;b:{for(e=0;e=d&&(b[c]=Math.random() src. Must start with https://. Found %s",a);var k=f.parse(d);D(!/\sallow-same-origin\s/i.test(" "+e+" ")||g!=k.origin&&"data:"!=m,"Origin of must not be equal to container %s if allow-same-origin is set. See https://github.com/ampproject/amphtml/blob/master/spec/amp-iframe-origin-policy.md for details.", a);D(!(ma(h,"."+fa.thirdPartyFrameHost)||ma(h,".ampproject.org")),"amp-iframe does not allow embedding of frames from ampproject.*: %s",b);return b} function bb(a){var b=a.element.getLayoutBox(),c=Math.min(600,.75*a.getViewport().getSize().height);D(b.top>=c," elements must be positioned outside the first 75% of the viewport or 600px from the top (whichever is smaller): %s Current position %s. Min: %sPositioning rules don't apply for iframes that use `placeholder`.See https://github.com/ampproject/amphtml/blob/master/extensions/amp-iframe/amp-iframe.md#iframe-with-placeholder for details.",a.element,b.top,c)} function cb(a,b){if(b){a=O(a.element,"url").parse(b);var c=a.hash;"data:"==a.protocol||c&&"#"!=c||(a=b.indexOf("#"),b=(-1==a?b:b.substring(0,a))+"#amp=1");return b}}l.preconnectCallback=function(a){this.iframeSrc&&M(this.win,"preconnect").url(this.getAmpDoc(),this.iframeSrc,a)}; l.buildCallback=function(){this.C=this.element.getAttribute("sandbox");var a;if(!(a=cb(this,this.element.getAttribute("src"))))if(a=this.element.getAttribute("srcdoc")){D(!(" "+this.C+" ").match(/\s+allow-same-origin\s+/i),"allow-same-origin is not allowed with the srcdoc attribute %s.",this.element);if("undefined"!==typeof TextEncoder)var b=(new TextEncoder("utf-8")).encode(a);else{a=unescape(encodeURIComponent(a));b=new Uint8Array(a.length);for(var c=0;cb||e>c)&&20>=b-f&&20>=c-e){c=!0;break a}}c=!1}this.T=c;c=this.element;b=c.getLayoutSize();d=b.height;this.F=10=d)}this.Z=c};function eb(a){if(a.h){var b=a.getViewport().getLayoutRect(a.h),c=a.getLayoutBox();a.R=Fa(b,-c.left,-c.top)}}l.getIntersectionElementLayoutBox=function(){if(!this.h)return AMP.BaseElement.prototype.getIntersectionElementLayoutBox.call(this);var a=this.getLayoutBox();this.R||eb(this);return Fa(this.R,a.left,a.top)}; l.layoutCallback=function(){var a=this;D(!this.Z,"amp-iframe is not used for displaying fixed ad. Please use amp-sticky-ad and amp-ad instead.");this.K||bb(this);this.L&&D(this.getOverflowElement(),"Overflow element must be defined for resizable frames: %s",this.element);if(!this.iframeSrc)return v();if(this.F&&!this.getAmpDoc().registerSingleton(1))return console.error("Only 1 analytics/tracking iframe allowed per page. Please use amp-analytics instead or file a GitHub issue for your use case: https://github.com/ampproject/amphtml/issues/new"), v();var b=this.element.ownerDocument.createElement("iframe");this.h=b;this.applyFillContent(b);b.name="amp_iframe"+Za++;this.K&&ya(b,-1);this.propagateAttributes(Ya,b);var c=b.getAttribute("allow")||"";c=c.replace("autoplay","autoplay-disabled");b.setAttribute("allow",c);b.setAttribute("sandbox",this.C||"");b.src=this.iframeSrc;this.F||(this.I=new Ha(this,b));b.onload=function(){b.readyState="complete";a.X();a.F&&(a.iframeSrc=null,N(a.win,"timer").promise(5E3).then(function(){b.parentElement&&b.parentElement.removeChild(b); a.element.setAttribute("amp-removed","");a.h=null}))};J(b,"embed-size",function(d){Z(a,d.height,d.width)},void 0,void 0,!0);this.O=sa(this.win,function(d){if(a.h&&d.source===a.h.contentWindow&&(d=d.data,"string"===typeof d&&d.startsWith("pym"))){var e=d.split(/xPYMx/);"height"===e[2]?Z(a,parseInt(e[3],10),void 0):"width"===e[2]?Z(a,void 0,parseInt(e[3],10)):B().warn("amp-iframe","Unsupported Pym.js message: "+d)}});this.K&&J(b,"embed-ready",this.X.bind(this));J(b,"send-consent-data",function(d,e, f){fb(a,e,f)});this.H.appendChild(b);this.U=!1;Sa(this.element,this.M);return this.loadPromise(b).then(function(){a.H!=a.element&&N(a.win,"timer").delay(function(){a.mutateElement(function(){a.H.classList.add("amp-active")})},1E3)})};function fb(a,b,c){Oa(a.element,a.getConsentPolicy()).then(function(d){var e=Object.assign(E({sentinel:"amp",type:"consent-data"}),d);b.postMessage(e,c)})} l.unlayoutCallback=function(){var a=this.element,b=this.M;Ta(a).unobserve(a,b);this.O&&(this.O(),this.O=null);this.h&&(a=this.h,a.parentElement&&a.parentElement.removeChild(a),this.N&&this.togglePlaceholder(!0),this.h=null,this.I&&(this.I.destroy(),this.I=null));return!0};l.getLayoutPriority=function(){return this.T?2:this.F?1:AMP.BaseElement.prototype.getLayoutPriority.call(this)}; l.mutatedAttributesCallback=function(a){var b=a.src;void 0!==b&&(this.iframeSrc=cb(this,b),this.h&&(this.h.src=ab(this,this.iframeSrc,this.C)));this.h&&a.title&&this.propagateAttributes(["title"],this.h)};l.unlayoutOnPause=function(){return!0};l.M=function(a){var b=this;if(a!==this.U){this.U=a;var c=!!this.element.getOwner();a||c||!this.h||this.getVsync().mutate(function(){return b.unload()})}};l.X=function(){var a=this;this.N&&this.getVsync().mutate(function(){a.h&&(ya(a.h,0),a.togglePlaceholder(!1))})}; l.firstLayoutCompleted=function(){};l.throwIfCannotNavigate=function(){if(!/\sallow-top-navigation\s/i.test(" "+this.C+" "))throw B().createError('"AMP.navigateTo" is only allowed on when its "sandbox" attribute contains "allow-top-navigation".');}; function Z(a,b,c){if(a.L)if(100>b)a.user().error("amp-iframe","Ignoring embed-size request because the resize height is less than 100px. If you are using amp-iframe to display ads, consider using amp-ad instead.",a.element);else{var d,e;b=parseInt(b,10);isNaN(b)||(d=Math.max(b+(a.element.offsetHeight-a.h.offsetHeight),b));c=parseInt(c,10);isNaN(c)||(e=Math.max(c+(a.element.offsetWidth-a.h.offsetWidth),c));void 0!==d||void 0!==e?a.attemptChangeSize(d,e).then(function(){void 0!==d&&a.element.setAttribute("height", d);void 0!==e&&a.element.setAttribute("width",e);a.element.overflowCallback(!1,d,e)},function(){}):a.user().error("amp-iframe","Ignoring embed-size request because no width or height value is provided",a.element)}else a.Y||(a.user().error("amp-iframe","Ignoring embed-size request because this iframe is not resizable",a.element),a.Y=!0)} function db(a){if(Ma(a.win)){var b=a.element,c=b.getAttribute("src");c&&(a.B=O(b,"url").parse(c).origin);a.registerAction("postMessage",function(f){a.B?a.h.contentWindow.postMessage(f.args,a.B):B().error("amp-iframe",'"postMessage" action is only allowed with "src"attribute with an origin.')});if(a.B){var d=0,e=function(f){if(f.source===a.h.contentWindow)if(f.origin!==a.B)B().error("amp-iframe",'"message" received from unexpected origin: '+f.origin+". Only allowed from: "+a.B);else{if(a.getAmpDoc().getRootNode().activeElement!== a.h)var g=!1;else g=a.win.document.createElement("audio"),g.play(),g=g.paused?!1:!0;if(g){var h=f.data;try{var m=JSON.parse(JSON.stringify(h))}catch(w){B().error("amp-iframe",'Data from "message" event must be JSON.');return}var k=a.win;f=E({data:m});g={detail:f};Object.assign(g,void 0);"function"==typeof k.CustomEvent?f=new k.CustomEvent("amp-iframe:message",g):(k=k.document.createEvent("CustomEvent"),k.initCustomEvent("amp-iframe:message",!!g.bubbles,!!g.cancelable,f),f=k);O(a.element,"action").trigger(a.element, "message",f,3)}else d++,B().error("amp-iframe",'"message" event may only be triggered from a user gesture.'),10<=d&&(B().error("amp-iframe",'Too many non-gesture-triggered "message" events; detaching event listener.'),a.win.removeEventListener("message",e))}};a.win.addEventListener("message",e)}}}l.ea=function(a){this.B=a};(function(a){a.registerElement("amp-iframe",W)})(self.AMP); })}); //# sourceMappingURL=amp-iframe-0.1.js.map